package svc

import (
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"house123/C/api/internal/config"
	"house123/C/api/internal/middleware"
	"house123/C/srv/houseclient"
)

type ServiceContext struct {
	Config   config.Config
	JwtToken rest.Middleware
	HouseSrv houseclient.House
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:   c,
		JwtToken: middleware.NewJwtTokenMiddleware().Handle,
		HouseSrv: houseclient.NewHouse(zrpc.MustNewClient(c.HouseSrv)),
	}
}
